
#import "Bottle_Menu.h"
#import "GameConfig.h"

@implementation Bottle_Menu

+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	Bottle_Menu *layer = [Bottle_Menu node];
	
	// add layer as a child to scene
	[scene addChild: layer];
	
	// return the scene
	return scene;
}

-(void)Bottle_Menu_Play:(id)sender
{
	if(delegate)
	{
		[delegate Bottle_MenuSelect:EBottle_Menu_Play];
	}
}

-(void)Bottle_Menu_Des:(id)sender
{
	if(delegate)
	{
		[delegate Bottle_MenuSelect:EBottle_Menu_Des];
	}
}

-(void)Bottle_Menu_Return:(id)sender
{
	if(delegate)
	{
		[delegate Bottle_MenuSelect:EBottle_Menu_Return];
	}
}

-(id)init:(id<Bottle_MenuDelegate>) _delegate
{
	self = [super init];
	if (self)
	{
		delegate = _delegate;
		
		[CCMenuItemFont setFontName:@"Arial"];
		
		[CCMenuItemFont setFontSize:40];
		
		//LOGO
		CCSprite *spLogo=[CCSprite spriteWithFile:@"logo.png"];
		spLogo.position = ccp(SCREEN_WIDTH/2,400);
		[self addChild:spLogo];
		
		
		CCSprite *spbottle_title=[CCSprite spriteWithFile:@"bottle_title.png"];
		spbottle_title.position = ccp(SCREEN_WIDTH/2,SCREEN_HEIGHT/2 + 20);
		[self addChild:spbottle_title];
		
		CCSprite *splogobg=[CCSprite spriteWithFile:@"logobg.png"];
		splogobg.position = ccp(SCREEN_WIDTH/2,SCREEN_HEIGHT/2 + 20);
		[self addChild:splogobg];
		
		//CCMenuItem *Game1 = [CCMenuItemFont itemFromString:@"开始游戏"		target:self selector:@selector(Bottle_Menu_Play:)];
		//CCMenuItem *Game2 = [CCMenuItemFont itemFromString:@"游戏说明"		target:self selector:@selector(Bottle_Menu_Des:)];
		
		//CCMenu *mn = [CCMenu menuWithItems:Game1, Game2, nil];
		
		//[mn alignItemsVerticallyWithPadding:40];
		
		//[self addChild:mn z:1 tag:2];
		
		CCMenuItemImage *startMenu = [CCMenuItemImage itemFromNormalImage:@"bottle_start.png" selectedImage:nil target:self selector:@selector(Bottle_Menu_Play:)];
		CCMenu *startmn = [CCMenu menuWithItems:startMenu,  nil];
		startmn.position = ccp(SCREEN_WIDTH/2,108);
		[self addChild:startmn z:1 tag:2];
		
		CCMenuItemImage *desMenu = [CCMenuItemImage itemFromNormalImage:@"bottle_des.png" selectedImage:nil target:self selector:@selector(Bottle_Menu_Des:)];
		CCMenu *desmn = [CCMenu menuWithItems:desMenu,  nil];
		desmn.position = ccp(SCREEN_WIDTH/2,60);
		[self addChild:desmn z:1 tag:2];
		
		
		//返回
		CCMenuItemImage *vm = [CCMenuItemImage itemFromNormalImage:@"back_icon.png" selectedImage:nil target:self selector:@selector(Bottle_Menu_Return:)];	
		CCMenu *vmm = [CCMenu menuWithItems: vm, nil];
		vmm.position = ccp(BOTTOM_X, BOTTOM_HEIGHT);
		[self addChild:vmm z:2];
		
		
	}
	return self;
}

- (void)layerReplaced
{
	
}

@end
